package com.truckdispatching.http.controller;

import java.util.HashMap;

import com.truckdispatching.UserManager;
import com.truckdispatching.http.util.TDHttpController;

/**
 * 版本更新请求
 * 
 * @author Lee
 * @date 2013-5-9
 */
public class ReportTruckLocationHttpController extends TDHttpController {

	@Override
	public String getRequestUrl() {
		return "http://gps1.566560.com:9125";
	}

	public void sendRequest(double latitude, double longitude) {
		HashMap<String, String> params = new HashMap<String, String>();
		params.put("type", "upload");
		params.put("username", UserManager.getMobile());
		params.put("time", String.valueOf(System.currentTimeMillis()));
		params.put("lat", String.valueOf(latitude));
		params.put("lng", String.valueOf(longitude));
		params.put("token", UserManager.getToken());
		sendRequest(params,false);
//		sendGetRequest(params);
	}

	@Override
	public void onSuccess(String response) {
		callOnResponseListener(null);
	}

	@Override
	public void onError(int errorCode, String errorMessage) {
		callOnResponseErrorListener(errorCode, errorMessage);
	}
}
